<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link href="<?=domain?>static/style/manage.css" rel="stylesheet" type="text/css" />
<link href="<?=domain?>static/style/fancybox.css" rel="stylesheet" type="text/css" />
<link href="<?=domain?>static/style/datepicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<?=domain?>static/scripts/core.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/datepicker.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/fancybox.js" charset="utf-8"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/swfobject.js"></script>
<script type="text/javascript" src="<?=domain?>static/scripts/manage.js" charset="utf-8"></script>
<title><?=name?></title>
<body class="hoariness">
<div class="head">
	<div class="area">
		<div class="logo">网站联盟管理后台</div>
		<div class="parent">
			<div class="nav">
				<ul>
					<?php
						foreach($menu as $key=>$value){
							echo '<li><a href="'.domain.'index.php?c='.$value['child'][0]['controller'].'&a='.$value['child'][0]['method'].'" class="'.(stristr($value['controller'],$this->request['controller'])?'sel':'').'">'.$value['name'].'</a></li>';
						}
					?>
	    		</ul>
			</div>
			<div class="user">欢迎您&nbsp;<?=$name?>&nbsp;,<a href="<?=domain?>index.php?c=manage&a=out">【退出】</a></div>
		</div>
	</div>
	<div class="child">
		<div class="nav">
			<?php
				$controller=0;$method=0;
				foreach($menu as $k=>$v){
					if(stristr($v['controller'],$this->request['controller'])){
						$controller=$k;
						echo '<ul class="sel '.$v['controller'].'">';
					}else{
						echo '<ul class="'.$v['controller'].'">';
					}
					foreach($v['child'] as $key=>$value){
						if($value['method']==$this->request['method']&&$value['controller']==$this->request['controller']){
							$method=$key;
						}
						echo '<li class="'.$value['method'].'"><a href="'.domain.'index.php?c='.$value['controller'].'&a='.$value['method'].'">'.$value['name'].'</a></li>';
					}
					echo '</ul>';
				}
			?>
		</div>
		<div class="place">当前位置:<?=$menu[$controller]['name']?>&nbsp;>&nbsp;<?=$menu[$controller]['child'][$method]['name']?></div>
	</div>
</div>
<div class="work">
	<div class="form">
		<h3 class="real">
			<div class="m"><?=$menu[$controller]['child'][$method]['name']?></div>
			<?php if(isset($purview['flux']['excel'])){?><a href="<?=(domain.'index.php?c=flux&a=excel')?>" class="hd add" action="excel">导出Excel</a><?php }?>
			<div class="date"><a href="#"><?=$date['start']?> -- <?=$date['end']?></a></div>
		</h3>
		<div class="chart">
			<div class="md">
				<div class="m">
					<div class="select" style="width:150px;" change="ChartLoad">
		           		<a href="#"><label style="color:#FF9900;">请选择指标</label><span></span><input type="hidden" name="metrics_chart" value="0"/></a>
		           		<ul class="limit" style="height:210px;">
		           		  <?php
		           		  foreach($metrics['chart'] as $key=>$value){
		           		  	echo '<li tab="'.$key.'"'.($key==$metrics_chart?' selected':'').'><a href="#">'.$value['name'].'</a></li>';
		           		  }
		           		  ?>
				   		</ul>
		           </div>
		           <div style="width:50px;padding-top:5px;text-align:center;">对比</div>
		           <div class="select" style="width:150px;" change="ChartLoad">
		           		<a href="#"><label style="color:#356aa0;"><?php if(isset($metrics['chart'][$contrast])){ echo $metrics['chart'][$contrast]['name'];?><?php }else{?>请选择指标<?php }?></label><span></span><input type="hidden" name="contrast" value="<?=empty($contrast)?0:$contrast;?>"/></a>
		           		<ul class="limit" style="height:210px;">
						  <?php
		           		  foreach($metrics['chart'] as $key=>$value){
		           		  	echo '<li tab="'.$key.'"'.($key==$contrast?' selected':'').'><a href="#">'.$value['name'].'</a></li>';
		           		  }
		           		  ?>
				   		</ul>
		           </div>
				</div>
				<div class="d">
					<a href="#" action="ChartLoad" chart="month"<?=($type=='month'?' class="k"':'')?>>月</a>
					<a href="#" action="ChartLoad" chart="week"<?=($type=='week'?' class="k"':'')?>>周</a>
					<a href="#" action="ChartLoad" chart="day"<?=($type=='day'?' class="k"':'')?>>日</a>
				</div>
			</div>
			<div class="line">
				<div id="chart"></div>
			</div>
		</div>
		<div class="ghb">
			 <table>
				 <thead>
					<tr>
						<th>总展示量</th>
						<th>总点击量</th>
						<th>总转化量</th>
						<th>总费用</th>
						<th>点击率</th>
						<th>转化率</th>
						<th style="border:0px;">平均点击价格</th>
					</tr>
				</thead>
				<tbody>
					<tr>
						<td><?=number_format(empty($ghb['impression'])?0:$ghb['impression'])?></td>
						<td><?=number_format(empty($ghb['click'])?0:$ghb['click'])?></td>
						<td><?=number_format(empty($ghb['transform'])?0:$ghb['transform'])?></td>
						<td>￥&nbsp;<?=number_format(empty($ghb['fee'])?0:$ghb['fee'],2)?></td>
						<td><?=number_format($ghb['click']/$ghb['impression']*100,2)?>%</td>
						<td><?=number_format($ghb['transform']/$ghb['impression']*100,2)?>%</td>
						<td style="border:0px;">￥&nbsp;<?=number_format($ghb['fee']/$ghb['click'],2)?></td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="dm">
			<div class="select" style="width:230px;" hide="DimMet" cache="<?=implode(',',array_merge(array_keys($sdim),array_keys($smet)))?>">
		        <a href="#"><label>维度&nbsp;&nbsp;&&nbsp;&nbsp;指标</label><span></span></a>
		        <div class="box" style="width:680px;height:auto;">
		        	<table class="fix">
						<thead>
							<tr>
								<th style="width:60px;">维度</th>
								<th>
									<?php
									foreach($dimensions as $key=>$value){
										echo '<label><input type="checkbox" name="dimensions[]" value="'.$key.'"'.(isset($sdim[$key])?' checked':'').'/><span>'.$value['name'].'</span></label>';
									}
									?>
								</th>
							</tr>
							<tr>
								<th>指标</th>
								<th>
									<?php
									foreach($metrics['table'] as $key=>$value){
										echo '<label><input type="checkbox" name="metrics_table[]" value="'.$key.'"'.(isset($smet[$key])?' checked':'').'/><span>'.$value['name'].'</span></label>';
									}
									?>
								</th>
							</tr>
						</thead>
					</table>
		        </div>
		     </div>
		</div>
		<div style="width:100%;height:auto;" id="table">
		 <table class="fix">
			<thead>
				<tr>
					<?php
					foreach($sdim as $key=>$value){
					?>
					<th><a href="<?=$basic?>&order=<?=$key?>&rule=<?=($rule=='desc'&&$order==$key?'asc':'desc')?>"><?=$value['name']?></a><?php if($order==$key){?><span class="<?=$rule?>"></span><?php }?></th>
					<?php
					}
					foreach($smet as $key=>$value){
					?>
					<th><a href="<?=$basic?>&order=<?=$key?>&rule=<?=($rule=='desc'&&$order==$key?'asc':'desc')?>"><?=$value['name']?></a><?php if($order==$key){?><span class="<?=$rule?>"></span><?php }?></th>
					<?php
					}
					?>
				</tr>
			</thead>
			<tbody>
				<?php
				foreach($table as $value){
					echo '<tr>';
					foreach($value as $v){
						echo '<td>'.$v.'</td>';
					}
					echo '</tr>';
				}
				?>
			</tbody>
		</table>
		<div class="pagination"><?=$pagination?>&nbsp;&nbsp;<font>共<?=$total?>条记录</font></div>
		</div>
	</div>
</div>
<div class="footer">
	<div class="credits">Power by <a href="http://www.cnadlm.com" target="_blank">cnadlm.com</a></div>
	<div class="connect">
		<a href="http://www.cnadlm.com" target="_blank">系统升级</a>
		<a href="http://www.cnadlm.com/help.html" target="_blank">帮助文档</a>
	</div>
</div>
</body>
</html>
<script language="JavaScript" type="text/javascript">
$('.date>a').DatePicker({
	position:'bottom',
	date: ['<?=$date['start']?>','<?=$date['end']?>'],
	calendars:2,
	mode:'range',
	onChange:function(formated){
		if(formated[1]!='1970-01-01'){
			$('.date>a').text(formated[0]+' -- '+formated[1]);
			$('.date>a').DatePickerHide();
			window.setTimeout(function(){
				location.href='<?=domain?>index.php?c=flux&a=index'+ChartUrl();
			},450);
		}
	}
});
function ChartUrl(){
	var date=$('.date').text().split(' -- ');
	var input=null,url='&start='+date[0]+'&end='+date[1];
	url+='&metrics_chart='+$('input[name="metrics_chart"]').attr('value');
	url+='&contrast='+$('input[name="contrast"]').attr('value');
	url+='&type='+$('a[chart][class="k"]').attr('chart');
	$('input:checked').each(function(){
		input=$(this);url+='&'+input.attr('name')+'='+input.attr('value');
	})
	return url;
}
function excel(){
	location.href='<?=domain?>index.php?c=flux&a=excel'+ChartUrl();
	return false;
}
swfobject.embedSWF(
  "static/scripts/chart.swf", "chart", "100%", "100%",
  "9.0.0", "expressInstall.swf",
  {"data-file":escape('<?=domain?>index.php?c=flux&a=index'+ChartUrl()+'&action=chart')},{wmode:"transparent"});
$('.select>.box>.fix').click(function(){
	if($('input:checked').length>8){
		alert('至多选择8个.');
		return false;
	}
});
FluxInit();
</script>